package com.dody.agile.payment.transaction;

import com.dody.agile.payment.classification.CommissionClassification;
import com.dody.agile.payment.employee.Employee;
import com.dody.agile.payment.model.SalesReceipt;

import java.util.Date;

/**
 * @author ShiXin
 * @date 2019/4/11 21:17
 * @description agile
 */
public class SalesReceiptTransaction extends PayrollTransaction{

    private Date date;
    private double amount;
    private int empId;

    @Override
    public void execute() {
        Employee e = payrollDatabase.getEmployee(empId);
        CommissionClassification cc = (CommissionClassification) e.getClassification();
        cc.addSalesReceipt(new SalesReceipt(date,amount));

    }

    public SalesReceiptTransaction(Date date, double amount, int empId) {
        this.date = date;
        this.amount = amount;
        this.empId = empId;
    }
}
